import moment from 'moment'
export const EmployeeBookListThead = [
  {
    type: 'selection',
    minWidth: 60,
    align: 'center'
  },
  {
    title: '姓名',
    minWidth: 150,
    tooltip: true,
    key: 'name',
    render: (h, params) => {
      var text = params.row.name
      const color = params.row.beHiring === false ? 'red' : ''
      return h('span', {
        domProps: {
          style: 'color: ' + color
        }
      }, text)
    },
    fixed: 'left'
  },
  {
    title: '身份证号码',
    minWidth: 200,
    key: 'idCardNo',
    render: (h, params) => {
      var text = params.row.idCardNo
      const color = params.row.beHiring === false ? 'red' : ''
      return h('span', {
        domProps: {
          style: 'color: ' + color
        }
      }, text)
    },
    fixed: 'left'
  },
  {
    title: '性别',
    minWidth: 80,
    key: 'sex',
    render: (h, params) => {
      const text = params.row.sex === 1 ? '男' : params.row.sex === 2 ? '女' : '未知'
      return h('span', text)
    }
  },
  {
    title: '手机号码',
    minWidth: 150,
    key: 'phone'
  },
  {
    title: '在职状态',
    minWidth: 120,
    key: 'beHiring'
  },
  {
    title: '公司名称',
    minWidth: 240,
    key: 'companyName'
  },
  {
    title: '部门',
    minWidth: 150,
    key: 'department'
  },
  {
    title: '职业',
    minWidth: 150,
    key: 'duty'
  },
  {
    title: '工资卡开户行',
    minWidth: 150,
    key: 'bankName'
  },
  {
    title: '工资卡卡号',
    minWidth: 180,
    key: 'accountNo'
  },
  {
    title: '工资发放银行',
    minWidth: 150,
    key: 'salaryBank'
  },
  {
    title: '入职时间',
    minWidth: 150,
    key: 'onBoardingDate',
    render: (h, params) => {
      let row = params.row
      let times = row.onBoardingDate ? moment(row.onBoardingDate).format('YYYY-MM-DD') : ''
      return h('span', times)
    }
  },
  {
    title: '创建时间',
    minWidth: 180,
    key: 'createTime',
    render: (h, params) => {
      let row = params.row
      let times = ''
      if (row.createTime) {
        times = row.createTime.slice(0, 19).replace(/T/g, ' ')
      }
      return h('span', times)
    }
  },
  {
    title: '在保种类',
    minWidth: 180,
    key: 'serviceType',
    // slot: 'serviceType',
  },
  {
    title: '操作',
    minWidth: 360,
    align: 'center',
    key: 'action',
    slot: 'action',
    fixed: 'right'
  }
]

// 商保替换
export const shangbaoReplaceThead = [
  {
    type: 'selection',
    minWidth: 60,
    align: 'center'
  },
  {
    title: '姓名',
    key: 'a',
    minWidth: 100
  },
  {
    title: '身份证号码',
    key: 'b'
  },
  {
    title: '起始时间',
    key: 'c'
  },
  {
    title: '终止时间',
    key: 'd'
  },
  {
    title: '商保金额',
    key: 'e'
  }
]

// 员工新增-添加离职信息
export const lizhiThead = [
  {
    type: 'selection',
    minWidth: 60,
    align: 'center'
  },
  {
    title: '离职类型',
    key: 'resignType',
    minWidth: 150,
    render: (h, params) => {
      const text = params.row.resignType === '0' ? '辞职' : params.row.resignType === '1' ? '被解除' : '辞退'
      return h('span', text)
    }
  },
  {
    title: '离职原因',
    key: 'resignReason',
    minWidth: 250
  },
  {
    title: '离职申请书提交日期',
    key: 'resignDate',
    minWidth: 150,
    minWidth: 150,
    render: (h, params) => {
      const text = params.row.resignDate ? params.row.resignDate.slice(0, 10) : ''
      return h('span', text)
    }
  },
  {
    title: '离职申请批准日期',
    key: 'approveDate',
    minWidth: 150,
    minWidth: 150,
    render: (h, params) => {
      const text = params.row.approveDate ? params.row.approveDate.slice(0, 10) : ''
      return h('span', text)
    }
  },
  {
    title: '离职日期',
    key: 'leaveDate',
    minWidth: 150,
    render: (h, params) => {
      const text = params.row.leaveDate ? params.row.leaveDate.slice(0, 10) : ''
      return h('span', text)
    }
  },
  {
    title: '经济补偿金',
    key: 'haveCompensation',
    minWidth: 150,
    render: (h, params) => {
      const text = params.row.haveCompensation == true ? '有' : '无'
      return h('span', text)
    }
  },
  {
    title: '经济补偿金金额',
    key: 'amount',
    minWidth: 150
  },
  {
    title: '补偿时间段',
    key: 'periodFrom',
    minWidth: 150,
    render: (h, params) => {
      const startTime = params.row.periodFrom ? (params.row.periodFrom).slice(0, 10) : '未知'
      const endTime = params.row.periodTo ? (params.row.periodTo).slice(0, 10) : '未知'
      const text = startTime + ' 至 ' + endTime
      return h('span', text)
    }
  },
  // {
  //   title: '操作',
  //   key: 'action',
  //   minWidth: 140,
  //   slot: 'action'
  // }
]

// 员工花名册详情-社会保险
export const shebaoThead = [
  {
    // type: 'selection',
    minWidth: 150,
    align: 'center',
    fixed: 'left',
    slot: 'leftTitle'
  },
  {
    title: '养老(单位)',
    key: 'PensionCompany',
    minWidth: 150
  },
  {
    title: '养老(个人)',
    key: 'PensionEmployee',
    minWidth: 150
  },
  {
    title: '医疗(单位)',
    key: 'MedicalCareCompany',
    minWidth: 150
  },
  {
    title: '医疗(个人)',
    key: 'MedicalCareEmployee',
    minWidth: 150
  },
  {
    title: '失业(单位)',
    key: 'UnemploymentCompany',
    minWidth: 150
  },
  {
    title: '失业(个人)',
    key: 'UnemploymentEmployee',
    minWidth: 150
  },
  {
    title: '工伤(单位)',
    key: 'InjuryOnTheJobCompany',
    minWidth: 150
  },
  {
    title: '工伤(个人)',
    key: 'InjuryOnTheJobEmployee',
    minWidth: 150
  },
  {
    title: '生育(单位)',
    key: 'BirthCompany',
    minWidth: 150
  },
  {
    title: '生育(个人)',
    key: 'BirthEmployee',
    minWidth: 150
  },
  {
    title: '大病医疗(单位)',
    key: 'SeriousIllnessCompany',
    minWidth: 150
  },
  {
    title: '大病医疗(个人)',
    key: 'SeriousIllnessEmployee',
    minWidth: 150
  },
  {
    title: '残疾人保障金(单位)',
    key: 'DisabledPersonsSecurityFundCompany',
    minWidth: 150
  },
  {
    title: '残疾人保障金(个人)',
    key: 'DisabledPersonsSecurityFundEmployee',
    minWidth: 150
  },
  {
    title: '门诊医疗(单位)',
    key: 'OutpatientDepartmentCompany',
    minWidth: 150
  },
  {
    title: '门诊医疗(个人)',
    key: 'OutpatientDepartmentEmployee',
    minWidth: 150
  }
]

// 员工花名册详情-社保记录
export const shebaojiluThead = [
  {
    title: '参保时间',
    key: 'year',
    width: 150,
    render: (h, params) => {
      const month = params.row.month < 10 ? '0' + params.row.month : '' + params.row.month
      const text = params.row.year + '' + month
      return h('span', text)
    }
  },
  {
    title: '参保编号',
    key: 'insureNo',
    minWidth: 150
  },
  {
    title: '养老(单位)',
    key: 'PensioncompanyFeeamt',
    minWidth: 150
  },
  {
    title: '养老(个人)',
    key: 'PensionemployeeFeeamt',
    minWidth: 150
  },
  {
    title: '医疗(单位)',
    key: 'MedicalCarecompanyFeeamt',
    minWidth: 150
  },
  {
    title: '医疗(个人)',
    key: 'MedicalCareemployeeFeeamt',
    minWidth: 150
  },
  {
    title: '失业(单位)',
    key: 'UnemploymentcompanyFeeamt',
    minWidth: 150
  },
  {
    title: '失业(个人)',
    key: 'UnemploymentemployeeFeeamt',
    minWidth: 150
  },
  {
    title: '工伤(单位)',
    key: 'InjuryOnTheJobcompanyFeeamt',
    minWidth: 150
  },
  {
    title: '工伤(个人)',
    key: 'InjuryOnTheJobemployeeFeeamt',
    minWidth: 150
  },
  {
    title: '生育(单位)',
    key: 'BirthcompanyFeeamt',
    minWidth: 150
  },
  {
    title: '生育(个人)',
    key: 'BirthemployeeFeeamt',
    minWidth: 150
  },
  {
    title: '大病医疗(单位)',
    key: 'SeriousIllnesscompanyFeeamt',
    minWidth: 150
  },
  {
    title: '大病医疗(个人)',
    key: 'SeriousIllnessemployeeFeeamt',
    minWidth: 150
  },
  {
    title: '残疾人保障金(单位)',
    key: 'DisabledPersonsSecurityFundcompanyFeeamt',
    minWidth: 150
  },
  {
    title: '残疾人保障金(个人)',
    key: 'DisabledPersonsSecurityFundemployeeFeeamt',
    minWidth: 150
  },
  {
    title: '门诊医疗(单位)',
    key: 'OutpatientDepartmentcompanyFeeamt',
    minWidth: 150
  },
  {
    title: '门诊医疗(个人)',
    key: 'OutpatientDepartmentemployeeFeeamt',
    minWidth: 150
  },
  {
    title: '单位合计',
    key: 'companyTotalAmt',
    minWidth: 150
  },
  {
    title: '个人合计',
    key: 'employeeTotalAmt',
    minWidth: 150
  },
  {
    title: '社保服务费',
    key: 'sfTotalAmt',
    minWidth: 150
  },
  {
    title: '合计',
    key: 'totalAmt',
    minWidth: 150
  }
]

// 员工建的社保列表
export const shebaoListThead = [
  {
    title: '社保编号',
    key: 'securityNO'
  },
  {
    title: '社保方案',
    key: 'planName'
  },
  {
    title: '参保时间',
    key: 'insuredTime',
    render: (h, params) => {
      const text = params.row.insuredTime ? params.row.insuredTime.slice(0, 10) : ''
      return h('span', text)
    }
  },
  {
    title: '补缴月数',
    key: 'payMonth'
  },
  {
    title: '备注',
    key: 'description'
  },
  {
    title: '申报工资',
    key: 'declareSalary'
  },
  {
    title: '操作',
    key: 'action',
    minWidth: 140,
    slot: 'action'
  }
]

// 员工花名册详情-公积金
export const gongjijinThead = [
  {
    minWidth: 150,
    align: 'center',
    fixed: 'left',
    slot: 'leftTitle'
  },
  {
    title: '公积金(单位)',
    key: 'ProvidentFundCompany'
  },
  {
    title: '公积金(个人)',
    key: 'ProvidentFundEmployee'
  }
]

// 员工花名册详情-公积金记录
export const gongjijinjiluThead = [
  {
    title: '参保时间',
    key: 'year',
    render: (h, params) => {
      const month = params.row.month < 10 ? '0' + params.row.month : '' + params.row.month
      const text = params.row.year + '' + month
      return h('span', text)
    }
  },
  {
    title: '参保编号',
    key: 'insureNo'
  },
  {
    title: '公积金(单位)',
    key: 'ProvidentFundcompanyFeeamt'
  },
  {
    title: '公积金(个人)',
    key: 'ProvidentFundemployeeFeeamt'
  },
  {
    title: '公积金服务费',
    key: 'sfTotalAmt'
  },
  {
    title: '合计',
    key: 'totalAmt'
  }
]

// 员工建的公积金列表
export const gongjijinListThead = [
  {
    title: '公积金编号',
    key: 'securityNO'
  },
  {
    title: '参保时间',
    key: 'insuredTime',
    render: (h, params) => {
      const text = params.row.insuredTime ? params.row.insuredTime.slice(0, 10) : ''
      return h('span', text)
    }
  },
  {
    title: '补缴月数',
    key: 'payMonth'
  },
  {
    title: '备注',
    key: 'description'
  },
  {
    title: '操作',
    key: 'action',
    minWidth: 140,
    slot: 'action'
  }
]

// 员工花名册详情-商保
export const shangbaoThead = [
  {
    title: '商保编号',
    key: 'securityNO'
  },
  {
    title: '商保金额',
    key: 'totalAmount'
  },
  {
    title: '起保时间',
    key: 'insuredTime',
    render: (h, params) => {
      const text = params.row.insuredTime ? params.row.insuredTime.slice(0, 10) : ''
      return h('span', text)
    }
  },
  {
    title: '被替换人姓名',
    key: 'originalEmployeeName'
  },
  {
    title: '被替换人身份证',
    key: 'originalEmployeeIdCardNo',
    width: 200
  },
  {
    title: '备注',
    key: 'description'
  },
  {
    title: '操作',
    key: 'action',
    minWidth: 140,
    slot: 'action'
  }
]

// 员工花名册详情-商保记录
export const shangbaojiluThead = [
  {
    title: '参保时间',
    key: 'year',
    render: (h, params) => {
      const month = params.row.month < 10 ? '0' + params.row.month : '' + params.row.month
      const text = params.row.year + '' + month
      return h('span', text)
    }
  },
  {
    title: '参保编号',
    key: 'insureNo'
  },
  {
    title: '商保金额',
    key: 'CommercialInsurancecompanyFeeamt'
  },
  {
    title: '商保服务费',
    key: 'sfTotalAmt'
  }
]

// 员工花名册详情-员工合同信息表格
export const hetongThead = [
  {
    title: '合同编号',
    key: 'code'
  },
  {
    title: '合同年限',
    key: 'duration'
  },
  {
    title: '劳动合同开始时间',
    key: 'startDate',
    render: (h, params) => {
      const text = params.row.startDate ? params.row.startDate.slice(0, 10) : ''
      return h('span', text)
    }
  },
  {
    title: '劳动合同结束时间',
    key: 'endDate',
    render: (h, params) => {
      const text = params.row.endDate ? params.row.endDate.slice(0, 10) : ''
      return h('span', text)
    }
  },
  {
    title: '附件上传',
    key: 'attachment',
    slot: 'attachment'
  },
  {
    title: '备注',
    key: 'remark'
  },
  // {
  //   title: '操作',
  //   key: 'action',
  //   minWidth: 140,
  //   slot: 'action'
  // }
]

// 薪资表格
export const xinziThead = [
  {
    title: '工资月份',
    key: 'salaryMonth',
    minWidth: 150,
    render: (h, params) => {
      const text = (params.row.salaryMonth).slice(0, 7)
      return h('span', text)
    }
  },
  {
    title: '计薪起止时间',
    key: 'salaryRange',
    minWidth: 240,
    render: (h, params) => {
      const timeArr = params.row.salaryRange.split('-')
      const startTime = timeArr[0].replace(/\//g, '-')
      const endTime = timeArr[1].replace(/\//g, '-')
      const text = startTime + ' 至 ' + endTime
      return h('span', text)
    }
  },
  {
    title: '工资发放日期',
    key: 'payDate',
    minWidth: 150,
    render: (h, params) => {
      const text = params.row.payDate ? params.row.payDate.slice(0, 10) : ''
      return h('span', text)
    }
  },
  {
    title: '收入类型',
    minWidth: 240,
    key: 'incomeTypeName'
  },
  {
    title: '应发工资总额',
    minWidth: 240,
    key: 'shouldSalaryTotal'
  },
  {
    title: '社保扣除',
    key: 'socialSecurityDeduct',
    minWidth: 150
  },
  {
    title: '公积金扣除',
    key: 'providentFundDeduct',
    minWidth: 150
  },
  {
    title: '专项附加扣除',
    key: 'specialDeduct',
    minWidth: 150
  },
  {
    title: '其他扣除',
    key: 'otherDeduct',
    minWidth: 150
  },
  {
    title: '个税扣除',
    key: 'incomeDeduct',
    minWidth: 150
  },
  {
    title: '手续费',
    key: 'serviceCharge',
    minWidth: 150
  },
  {
    title: '累计抵扣',
    key: 'historyDeduct',
    minWidth: 150
  },
  {
    title: '实发工资总额',
    key: 'realSalaryTotal',
    minWidth: 150
  },
  {
    title: '薪资服务费',
    key: 'sfTotalAmt',
    minWidth: 150
  },
  {
    title: '备注',
    key: 'description',
    minWidth: 150
  }
]
